package com.boot.controller;

import com.boot.business.PurchaseDTO;
import com.boot.order.OrderDTO;
import com.boot.result.Result;
import com.boot.service.OrderService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
@AllArgsConstructor
public class OrderController {
    private final OrderService orderService;
    @GetMapping("/{id}")
    public Result getOrderById(@PathVariable Long id) {
        return orderService.getOrderById(id);
    }

    @PostMapping("/createOrder")
    public Result createOrder(@RequestBody PurchaseDTO purchaseDTO) {
        return orderService.createOrder(purchaseDTO);
    }
}
